package com.wzh.multithreaddemo;

import android.annotation.SuppressLint;
import android.app.IntentService;
import android.content.Intent;

import androidx.annotation.Nullable;

import com.wzh.advancelog.log.WzhLog;

/**
 * @author: zhwang37
 * @date: 2021/11/23 18:15
 * @email:zhwang37@iflytek.com
 * @describe:
 */
public class MyIntentService extends IntentService {
    /**
     * Creates an IntentService.  Invoked by your subclass's constructor.
     *
     * @param name Used to name the worker thread, important only for debugging.
     */

    public MyIntentService(String name) {
        super(name);
    }

    public MyIntentService() {
        super("MyIntentService");
    }

    @SuppressLint("DefaultLocale")
    @Override
    protected void onHandleIntent(@Nullable Intent intent) {
        int index = 0;
        if (intent != null) {
            index = intent.getIntExtra("index", 0);
        }
        WzhLog.i(LogTag.WZH_LOG, String.format("执行第%d次(%s)", index, Thread.currentThread().getName()));
    }
}
